<?php
/**
 * --------------------------------------------------------------------
 * MCore精简框架
 * 作者：阿枫，QQ：52037872，Email：support@mdeve.com
 * --------------------------------------------------------------------
 *
 * SVN revision information:
 * @version $Revision: 1 $:
 * @author  $Author: zy $:
 * @date      $Date: 2017-03-10 21:12:21 +0800 (星期五, 10 三月 2017) $:
 */

chdir("../");
require dirname(__FILE__). '/runtime.php';
global $_M, $m, $a, $ext, $f, $args, $page;

$m = htmlspecialchars(filter_input(INPUT_GET, "m"));	// module
$a = htmlspecialchars(filter_input(INPUT_GET, "a"));		// action
$ext = htmlspecialchars(filter_input(INPUT_GET, "ext"));	// ext
$args = htmlspecialchars(filter_input(INPUT_GET, "args"));
$page = intval(filter_input(INPUT_GET, "page", FILTER_SANITIZE_NUMBER_INT));
if(!strlen($m)) $m = "index";
if(!strlen($a)) $a = "main";
if($page<1) $page = 1;

if($_M->cfg["module_enable"]) module_insert_code('module_start');

require_once CORE_PATH. '/class/base.php';
$f = dirname(dirname(__FILE__)). "/module/common/". strtolower($m). ".module.php";

if($_M->cfg["module_enable"]) module_insert_code('module_proc');

if(file_exists($f)){
    require $f;
    $mod = "_". ucfirst($m)."Class";
    $module = new $mod();
    if(!method_exists($module, $a)) $a = "_". $a;
    $module->$a();
}else{
    halt("Module {$m} not found!");
    //header("Location: /static/404.html");
    exit;
}
